<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>具名插槽的使用</title>
</head>
<body>
<div id="app">
    <cpn></cpn>

    <!--如果插入一个元素，所有的 slot 都会被该元素替换-->
    <cpn>
        <div>content</div>
    </cpn>

    <!--插入的内容，会将每个 slot 都进行替换一次-->
    <cpn>
        <div>left</div>
        <div>center</div>
        <div>right</div>
    </cpn>
</div>

<template id="cpn">
    <h1>这是一个自定义组件</h1>
    <slot>
        <span>左边</span>
    </slot>
    <slot>
        <span>中间</span>
    </slot>
    <slot>
        <span>右边</span>
    </slot>
</template>

<script type="module">
    import {createApp, defineComponent} from "../../../js/vue.esm-browser.js";

    let component = defineComponent(
        {
            template: "#cpn",
        }
    );

    let app = createApp(
        {
            setup() {
                return {}
            }
        }
    );

    app.component("cpn", component)

    app.mount("#app")
</script>
</body>
</html>